<?php
if (preg_match ( "/".basename ( __FILE__ )."/", $_SERVER ['PHP_SELF'] )) {
	die ("<h1>Incorrect access</h1>You cannot access this file directly.");
}
class index {
	function playme(){
		$code = FunctionLib::getParam('code');
		switch( $code )
		{
			case 'nextItem':
				$this->getNextItem();
				break;	
			default:
				$this->home();
				break;
		}
	}
	
	function getNextItem() {
		$next = FunctionLib::getParam('next', '');
		if($next) {
			//Create our Application instance (replace this with your appId and secret).
			$facebook = new Facebook(array(
				'appId'     => FB_API_KEY,
				'secret'    => FB_SECRET,
				'cookie'    => true
			));
			
			//Get User ID
			$user = $facebook->getUser();
			if($user) {
				try {
					// Proceed knowing you have a logged in user who's authenticated.
					$album = $facebook->api($next.'?limit=27');
					$logoutUrl = $facebook->getLogoutUrl();
					
					$Paging = $album['paging'];
					$album = array_values($album);
					
					prt($album)
					
				} catch (FacebookApiException $e) {
					error_log($e);
					$user = null;
				}
			}
		}
		else {
			echo FunctionLib::JsonErr('err_url');
		}
	}

	function home(){
		global $display;
		die("Nothing to do...");
	}
}
?>